var operator = "="

function getCookieValue(keyStr) {
    var valStr = null;
    var s = window.document.cookie; //获取到所有的键值对，并且弄成了一个字符串，因此需要截取
    var arr = s.split("; ");
    for (var i = 0; i < arr.length; i++) {
        var str = arr[i];
        var k = str.split(operator)[0];
        var v = str.split(operator)[1];
        if (k == keyStr) {
            valStr = v;
            break;
        }
    }
    return valStr;
}

function setCookieValue(key, value) {
    document.cookie = key + operator + value;
}